/*
 * @Description: 动态路由
 * @Author: DHL
 * @Date: 2022-01-09 15:56:57
 * @LastEditors: DHL
 * @LastEditTime: 2023-01-16 15:19:47
 */

import type { Router } from 'vue-router'
import { usePermissionStore } from '@/store/modules/permission'

/**
 * 注册服务端返回动态路由
 * 注册前端配置的动态路由
 * @param router
 */
export function createPermissionGuard(router: Router) {
  return new Promise<void>((resolve, reject) => {
    const permissionStore = usePermissionStore()

    // 构建路由
    permissionStore.buildRoutesAction()

    resolve()
  })
}
